
xc=zeros(length(ROIs));

for ind=1:length(ROIs)
    for knd=1:length(ROIs)
        xc(ind,knd)=sum(ROIs(ind).activity.*ROIs(knd).activity)/sqrt(sum(ROIs(ind).activity.^2))/sqrt(sum(ROIs(knd).activity.^2));
    end
end


act=zeros(length(ROIs(1).activity),length(ROIs));
for ind=1:length(ROIs)
    act(:,ind)=ROIs(ind).activity;
end
    
xcoeff=corrcoef(act);
figure;imagesc(xcoeff>0.8)
